home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 076-100 / disk_084 / ed / move.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  831b  |  48 lines

  1. /*
  2.  * Copyright 1987 Brian Beattie Rights Reserved.
  3.  *
  4.  * Permission to copy and/or distribute granted under the
  5.  * following conditions:
  6.  *
  7.  * 1). No charge may be made other than resonable charges
  8.  *    for reproduction.
  9.  *
  10.  * 2). This notice must remain intact.
  11.  *
  12.  * 3). No further restrictions may be added.
  13.  *
  14.  */
  15. #include <stdio.h>
  16. #include "tools.h"
  17. #include "ed.h"
  18.  
  19. move(num)
  20. int    num;
  21. {
  22.     LINE    *k0, *k1, *k2, *k3;
  23.  
  24.     if(line1 <= 0 || line1 <= num && num <= line2)
  25.         return( ERR );
  26.     k0 = getptr(prevln(line1));
  27.     k1 = getptr(line1);
  28.     k2 = getptr(line2);
  29.     k3 = getptr(nextln(line2));
  30.  
  31.     relink(k0, k3, k0, k3);
  32.  
  33.     if(num > line1)
  34.     {
  35.         curln = num;
  36.         num += line2-line1+1;
  37.     } else
  38.         curln = num + (line2 - line1 + 1);
  39.  
  40.     k0 = getptr(num);
  41.     k3 = getptr(nextln(num));
  42.  
  43.     relink(k0, k1, k2, k3);
  44.     relink(k2, k3, k0, k1);
  45.  
  46.     return( 1 );
  47. }
  48.